// vue.config.js
const path = require('path');

const autoprefixer = require('autoprefixer');

function resolve (dir) {
    return path.join(__dirname, dir);
}

module.exports = {
    indexPath: 'live.html',
    publicPath: process.env.NODE_ENV === 'production'
        ? ''
        : '/',
    devServer: {
        proxy: {
            '/': {
                // target: 'http://115.28.37.216:8089',
                target: 'http://www.jufuzg.com',
                ws: false,
                changeOrigin: true,
            }
        },
        // disableHostCheck: true,
        host: '0.0.0.0',
        port: 8108,
    },
    chainWebpack: (config) => {
        config.resolve.alias
            .set('@', resolve('src'))
            .set('views', resolve('src/views'))
            .set('landingpages', resolve('src/landingpages'))
            .set('components', resolve('src/components'))
            .set('assets', resolve('src/assets'))
            .set('utils', resolve('src/utils'))
            .set('api', resolve('src/api'))
            .set('store', resolve('src/store'))
            .set('router', resolve('src/router'))
    },
    css: {
        loaderOptions: {
            postcss: {
                plugins: [
                    autoprefixer(),
                ],
            },
        },
    },
};
